# Maintainer: Antonio Rojas <arojas@archlinux.org>

pkgname=libetebase
pkgver=0.5.6
pkgrel=2
pkgdesc='Etebase C library'
arch=(loong64 x86_64)
url='https://github.com/etesync/libetebase'
license=(BSD)
depends=(gcc-libs
         glibc
         libsodium
         openssl)
makedepends=(rust)
source=(https://github.com/etesync/libetebase/archive/v$pkgver/$pkgname-$pkgver.tar.gz)
sha256sums=('b149afcabce839347cb3cef870e781d34df32016885bfed50c08dcab0ab9b1f0')

prepare() {
  cd $pkgname-$pkgver
  cargo fetch --locked --target "`uname -m`-unknown-linux-gnu"
}

build() {
  cd $pkgname-$pkgver
  env CARGO_INCREMENTAL=0 SODIUM_USE_PKG_CONFIG= cargo build --release --locked --offline
  make pkgconfig
}

package() {
  cd $pkgname-$pkgver
  make DESTDIR="$pkgdir" install

  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname
}
